<template>
	<view class="tui-set-box">
		<tui-list-cell padding="0" :lineLeft="false" :arrow="true" @click="href('../userInfo/userInfo')">
			<view class="tui-list-cell tui-info-box">
				<image :src="userinfo.avatar?userinfo.avatar:'/static/images/my/mine_def_touxiang_3x.png'" class="tui-avatar"></image>
				<view>{{userinfo.nick_name?userinfo.nick_name:'用户昵称'}}</view>
			</view>
		</tui-list-cell>
		<!-- <tui-list-cell padding="0" :lineLeft="false" :arrow="true" @click="href('../address/address')">
			<view class="tui-list-cell">
				地址管理
			</view>
		</tui-list-cell> -->
		<!-- <view class="tui-mtop">
			<tui-list-cell padding="0" :lineLeft="false" :arrow="true" @click="href('/pages/bank/bank')">
				<view class="tui-list-cell">
					银行卡管理
				</view>
			</tui-list-cell>
		</view> -->
		<view class="tui-mtop">
			<tui-list-cell padding="0" :lineLeft="false" :arrow="true" @click="href('/pages/login/changePwd/changePwd')">
				<view class="tui-list-cell">
					修改密码
				</view>
			</tui-list-cell>
		</view>
		<view class="tui-mtop">
			<tui-list-cell padding="0" :lineLeft="false" :arrow="true" @click="href('/pages/doc/about/about')">
				<view class="tui-list-cell">
					关于我们
				</view>
			</tui-list-cell>
			
		</view>

		<view class="tui-exit">
			<tui-button @click="logout" shape="circle" shadow type="danger" height="88rpx">退出登录</tui-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo:[],
			}
		},
		onShow() {
			this.tui.chkAuth()
			let it =this;
			this.tui.request('user/api/getuser','GET').then(function(res){
				if(res.code == 1){
					it.userinfo = res.data;
				}
			})
		},
		methods: {
			href(page) {
				this.tui.openPage(page);
			},
			logout(){
				uni.clearStorage();
				this.tui.get('user/login/logout');
				this.tui.openPage('/pages/login/login/login')
			}
		}
	}
</script>

<style>
	.tui-set-box {
		padding-bottom: 20rpx;
		color: #333;
	}

	.tui-list-cell {
		display: flex;
		align-items: center;
		padding: 24rpx 30rpx;
		font-size: 30rpx;
	}

	.tui-info-box {
		font-size: 34rpx;
	}

	.tui-avatar {
		width: 140rpx;
		height: 140rpx;
		margin-right: 20rpx;
		border-radius: 100rpx;
	}

	.tui-mtop {
		margin-top: 20rpx;
	}

	.tui-exit {
		padding: 100rpx 24rpx;
	}
</style>
